package com.kh.first.controller;

import com.kh.first.pojo.common.AjaxJson;
import com.kh.first.pojo.common.WxDepartment;
import com.kh.first.service.WxCommonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("wxUserController")
public class WxUserController {

    @Autowired
    WxCommonService wxCommonService;

    @RequestMapping(params = "getDepartmentUser")
    @ResponseBody//department like "%1,%"
    public AjaxJson<WxDepartment> getDepartmentUser() {
        AjaxJson<WxDepartment> ajaxJson = new AjaxJson<>();
        WxDepartment tree = wxCommonService.getTree().get(0);
        ajaxJson.data = tree;
        return ajaxJson;
    }
}
